

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:test01/okhttp_test/pojo/login_request_pojo.dart';
import 'package:test01/okhttp_test/util/request_http.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    ///禁止程序横屏
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp, //只能纵向
      DeviceOrientation.portraitDown, //只能纵向
    ]);

    return MaterialApp(
      title: '页面一',
      home: new TestPage(),
    );
  }
}




class TestPage extends StatefulWidget {
  const TestPage({Key key}) : super(key: key);

  @override
  _TestPageState createState() => _TestPageState();
}

class _TestPageState extends State<TestPage> {

  void mm() async{
  LoginRequst loginRequst=LoginRequst(grant_type:"anonymous",authorization: "Basic dXNlckFwcDpBaW15Rml0bmVzcw==");
  LoginRespons loginRespons=await getinittokens(loginRequst, "/uaa/oauth/login");
  tokens="${loginRespons.token_type} ${loginRespons.access_token}";
  print("--------------获取到匿名${tokens}---------------------");
}

@override
  void initState() {
    // TODO: implement initState
  mm();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Container();
  }
}
